﻿using DAL;
using Model;
using System;
using System.Collections.Generic;
using System.Text;

namespace BLL
{
    public class SellerBll
    {
        private SellerDal _dal = new SellerDal();

        /// <summary>
        /// 验证用户
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public Seller ValidateLogin(string userName, string password)
        {
            return _dal.ValidateLogin(userName, password);
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        public void Add(Seller model)
        {
            _dal.Add(model);
        }

        /// <summary>
        /// 检查是否已存在该Email
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public bool EmailExisted(string email)
        {
            if (_dal.GetList("email='"+email+"'").Rows.Count > 0)
                return true;
            else
                return false;
        }

        /// <summary>
        /// 检查是否已存在该用户名
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public bool UserNameExisted(string username)
        {
            if (_dal.GetList("username='" + username + "'").Rows.Count > 0)
                return true;
            else
                return false;
        }

    }
}
